package com.js.data.dtmg.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.js.data.common.api.CommonResult;
import com.js.data.dtmg.dto.DataQuery;
import com.js.data.dtmg.dto.DtTaskLogQuery;
import com.js.data.dtmg.service.DtTaskLogService;
import com.js.data.dtmg.vo.DtCrontabLogVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 定时任务日志表 前端控制器
 * </p>
 *
 * @author hh
 * @since 2024-07-19
 */
@RestController
@RequestMapping("/dtmg/dtTaskLog")
public class DtTaskLogController {

    @Resource
    private DtTaskLogService service;

    /**
     * 用户分页
     *
     * @param query 查询条件
     * @return IPage<UserPageVO>
     */
    @GetMapping(value = "pageList")
    public CommonResult<IPage<DtCrontabLogVO>> pageList(@ModelAttribute DtTaskLogQuery query) {
        return CommonResult.success(service.pageList(query));
    }
    @GetMapping(value = "dataPageList")
    public CommonResult<IPage<Map<String,Object>>> dataPageList(@Validated @ModelAttribute DataQuery query) {
        return CommonResult.success(service.dataPageList(query));
    }
    @GetMapping(value = "/redoTask/{logId}")
    public CommonResult<Void> redoTask(@PathVariable Long logId) {
        service.redoTask(logId);
        return CommonResult.success();
    }

}

